home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / Balloons.p < prev    next >
Encoding:
Text File  |  1991-04-03  |  9.4 KB  |  227 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {
  4. Created: Saturday, January 12, 1991 at 4:19 PM
  5.     Balloons.p
  6.     Pascal Interface to the Macintosh Libraries
  7.  
  8.         Copyright Apple Computer, Inc. 1990
  9.         All rights reserved
  10. }
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18.     UNIT Balloons;
  19.     INTERFACE USES    Types,Quickdraw,Menus,TextEdit,Traps;
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. CONST
  46. hmBalloonHelpVersion = $0002;   { The real version of the Help Manager }
  47.  
  48. {Help Mgr error range: -850 to -874}
  49. hmHelpDisabled = -850;          { Show Balloons mode was off, call to routine ignored }
  50. hmBalloonAborted = -853;        { Returned if mouse was moving or mouse wasn't in window port rect }
  51. hmSameAsLastBalloon = -854;     { Returned from HMShowMenuBalloon if menu & item is same as last time }
  52. hmHelpManagerNotInited = -855;  { Returned from HMGetHelpMenuHandle if help menu not setup }
  53. hmSkippedBalloon = -857;        { Returned from calls if helpmsg specified a skip balloon }
  54. hmWrongVersion = -858;          { Returned if help mgr resource was the wrong version }
  55. hmUnknownHelpType = -859;       { Returned if help msg record contained a bad type }
  56. hmOperationUnsupported = -861;  { Returned from HMShowBalloon call if bad method passed to routine }
  57. hmNoBalloonUp = -862;           { Returned from HMRemoveBalloon if no balloon was visible when call was made }
  58. hmCloseViewActive = -863;       { Returned from HMRemoveBalloon if CloseView was active }
  59. kHMHelpMenuID = -16490;         { Resource ID and menu ID of help menu }
  60. kHMAboutHelpItem = 1;           { help menu item number of About Balloon Help… }
  61. kHMShowBalloonsItem = 3;        { help menu item number of Show/Hide Balloons }
  62. kHMHelpID = -5696;              { ID of various Help Mgr package resources (in Pack14 range) }
  63. kBalloonWDEFID = 126;           { Resource ID of the WDEF proc used in standard balloons }
  64.  
  65. {Dialog item template type}
  66. helpItem = 1;                   { key value in DITL template that corresponds to the help item }
  67.  
  68. { Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources }
  69. hmDefaultOptions = 0;           { default options for help manager resources }
  70. hmUseSubID = 1;                 { treat resID's in resources as subID's of driver base ID }
  71. hmAbsoluteCoords = 2;           { ignore window port origin and treat rectangles as absolute coords }
  72. hmSaveBitsNoWindow = 4;         { don't create a window, just blast bits on screen. No update event is generated }
  73. hmSaveBitsWindow = 8;           { create a window, but restore bits behind window when window goes away }
  74. hmMatchInTitle = 16;            { for hwin resources, match string anywhere in window title string }
  75.  
  76. { Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources }
  77. kHMStringItem = 1;              { pstring used in resource }
  78. kHMPictItem = 2;                { 'PICT' ResID used in resource }
  79. kHMStringResItem = 3;           { 'STR#' ResID & index used in resource }
  80. kHMTEResItem = 6;               { Styled Text Edit ResID used in resource ('TEXT' & 'styl') }
  81. kHMSTRResItem = 7;              { 'STR ' ResID used in resource }
  82. kHMSkipItem = 256;              { don't display a balloon }
  83. kHMCompareItem = 512;           { Compare pstring in menu item w/ PString in resource item }
  84. kHMNamedResourceItem = 1024;    { Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) }
  85. kHMTrackCntlItem = 2048;        { Reserved }
  86.  
  87. { Constants for hmmHelpType's when filling out HMMessageRecord }
  88. khmmString = 1;                 { help message contains a PString }
  89. khmmPict = 2;                   { help message contains a resource ID to a 'PICT' resource }
  90. khmmStringRes = 3;              { help message contains a res ID & index to a 'STR#' resource }
  91. khmmTEHandle = 4;               { help message contains a Text Edit handle }
  92. khmmPictHandle = 5;             { help message contains a Picture handle }
  93. khmmTERes = 6;                  { help message contains a res ID to 'TEXT' & 'styl' resources }
  94. khmmSTRRes = 7;                 { help message contains a res ID to a 'STR ' resource }
  95. kHMTETextResType = 'TEXT';      { Resource Type of text data for styled TE record w/o style info }
  96. kHMTEStyleResType = 'styl';     { Resource Type of style information for styled TE record }
  97.  
  98. {Generic defines for the switch items used in 'hmnu' & 'hdlg'}
  99. kHMEnabledItem = 0;             { item is enabled, but not checked or control value = 0 }
  100. kHMDisabledItem = 1;            { item is disabled, grayed in menus or disabled in dialogs }
  101. kHMCheckedItem = 2;             { item is enabled, and checked or control value = 1 }
  102. kHMOtherItem = 3;               { item is enabled, and control value > 1 }
  103.  
  104. { Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages }
  105. kHMMenuResType = 'hmnu';        { ResType of help resource for supporting menus }
  106. kHMDialogResType = 'hdlg';      { ResType of help resource for supporting dialogs }
  107. kHMWindListResType = 'hwin';    { ResType of help resource for supporting windows }
  108. kHMRectListResType = 'hrct';    { ResType of help resource for rectangles in windows }
  109. kHMOverrideResType = 'hovr';    { ResType of help resource for overriding system balloons }
  110. kHMFinderApplResType = 'hfdr';  { ResType of help resource for custom balloon in Finder }
  111.  
  112. { constants to pass to method parameter in HMShowBalloon }
  113. kHMRegularWindow = 0;           { Create a regular window floating above all windows }
  114. kHMSaveBitsNoWindow = 1;        { Just save the bits and draw (for MDEF calls) }
  115. kHMSaveBitsWindow = 2;          { Regular window, save bits behind, AND generate update event }
  116.  
  117. TYPE
  118. HMStringResType = RECORD
  119.     hmmResID: INTEGER;
  120.     hmmIndex: INTEGER;
  121.     END;
  122.  
  123. HMMessageRecPtr    = ^HMMessageRecord;
  124. HMMessageRecord    = RECORD
  125.                 hmmHelpType            : INTEGER;
  126.                 CASE INTEGER OF
  127.                 khmmString:
  128.                     (hmmString: STR255);
  129.                 khmmPict:
  130.                     (hmmPict: INTEGER);
  131.                 khmmStringRes:
  132.                     (hmmStringRes: HMStringResType);
  133.                 khmmTEHandle:
  134.                     (hmmTEHandle: TEHandle);
  135.                 khmmPictHandle:
  136.                     (hmmPictHandle: PicHandle);
  137.                 khmmTERes:
  138.                     (hmmTERes: INTEGER);
  139.                 khmmSTRRes:
  140.                     (hmmSTRRes: INTEGER);
  141.                 END;
  142.  
  143.  
  144.  
  145. {  Public Interfaces  }
  146. FUNCTION HMGetHelpMenuHandle(VAR mh: MenuHandle): OSErr;
  147.     INLINE $303C,$0200,_Pack14;
  148. FUNCTION HMShowBalloon(aHelpMsg: HMMessageRecord;
  149.                        tip: Point;
  150.                        alternateRect: RectPtr;
  151.                        tipProc: Ptr;
  152.                        theProc: INTEGER;
  153.                        variant: INTEGER;
  154.                        method: INTEGER): OSErr;
  155.     INLINE $303C,$0B01,_Pack14;
  156. FUNCTION HMRemoveBalloon: OSErr;
  157.     INLINE $303C,$0002,_Pack14;
  158. FUNCTION HMGetBalloons: BOOLEAN;
  159.     INLINE $303C,$0003,_Pack14;
  160. FUNCTION HMSetBalloons(flag: BOOLEAN): OSErr;
  161.     INLINE $303C,$0104,_Pack14;
  162. FUNCTION HMShowMenuBalloon(itemNum: INTEGER;
  163.                            itemMenuID: INTEGER;
  164.                            itemFlags: LONGINT;
  165.                            itemReserved: LONGINT;
  166.                            tip: Point;
  167.                            alternateRect: RectPtr;
  168.                            tipProc: Ptr;
  169.                            theProc: INTEGER;
  170.                            variant: INTEGER): OSErr;
  171.     INLINE $303C,$0E05,_Pack14;
  172. FUNCTION HMGetIndHelpMsg(whichType: ResType;
  173.                          whichResID: INTEGER;
  174.                          whichMsg: INTEGER;
  175.                          whichState: INTEGER;
  176.                          VAR options: LONGINT;
  177.                          VAR tip: Point;
  178.                          VAR altRect: Rect;
  179.                          VAR theProc: INTEGER;
  180.                          VAR variant: INTEGER;
  181.                          VAR aHelpMsg: HMMessageRecord;
  182.                          VAR count: INTEGER): OSErr;
  183.     INLINE $303C,$1306,_Pack14;
  184. FUNCTION HMIsBalloon: BOOLEAN;
  185.     INLINE $303C,$0007,_Pack14;
  186. FUNCTION HMSetFont(font: INTEGER): OSErr;
  187.     INLINE $303C,$0108,_Pack14;
  188. FUNCTION HMSetFontSize(fontSize: INTEGER): OSErr;
  189.     INLINE $303C,$0109,_Pack14;
  190. FUNCTION HMGetFont(VAR font: INTEGER): OSErr;
  191.     INLINE $303C,$020A,_Pack14;
  192. FUNCTION HMGetFontSize(VAR fontSize: INTEGER): OSErr;
  193.     INLINE $303C,$020B,_Pack14;
  194. FUNCTION HMSetDialogResID(resID: INTEGER): OSErr;
  195.     INLINE $303C,$010C,_Pack14;
  196. FUNCTION HMSetMenuResID(menuID: INTEGER;
  197.                         resID: INTEGER): OSErr;
  198.     INLINE $303C,$020D,_Pack14;
  199. FUNCTION HMBalloonRect(aHelpMsg: HMMessageRecord;
  200.                        VAR coolRect: Rect): OSErr;
  201.     INLINE $303C,$040E,_Pack14;
  202. FUNCTION HMBalloonPict(aHelpMsg: HMMessageRecord;
  203.                        VAR coolPict: PicHandle): OSErr;
  204.     INLINE $303C,$040F,_Pack14;
  205. FUNCTION HMScanTemplateItems(whichID: INTEGER;
  206.                              whichResFile: INTEGER;
  207.                              whichType: ResType): OSErr;
  208.     INLINE $303C,$0410,_Pack14;
  209. FUNCTION HMExtractHelpMsg(whichType: ResType;whichResID: INTEGER;whichMsg: INTEGER;
  210.     whichState: INTEGER;VAR aHelpMsg: HMMessageRecord): OSErr;
  211.     INLINE $303C,$0711,_Pack14;
  212. FUNCTION HMGetDialogResID(VAR resID: INTEGER): OSErr;
  213.     INLINE $303C,$0213,_Pack14;
  214. FUNCTION HMGetMenuResID(menuID: INTEGER;VAR resID: INTEGER): OSErr;
  215.     INLINE $303C,$0314,_Pack14;
  216. FUNCTION HMGetBalloonWindow(VAR window: WindowPtr): OSErr;
  217.     INLINE $303C,$0215,_Pack14;
  218.  
  219.  
  220.     { UsingBalloons }
  221.  
  222.  
  223.     IMPLEMENTATION
  224. END.
  225.  
  226.  
  227.